/**
 * UserPermission.java
 *
 * @Author : lostprobe
 * @Date : 2022/05/11 09:47
 * @Brief : 定义用户权限
 */

package com.bookcity.enums;

public enum UserPermission implements BaseEnum{

    USER(1),
    ADMIN(2);

    private int id;

    @Override
    public int getCode() {
        return this.id;
    }

    UserPermission(int id) {
        this.id = id;
    }

    public static UserPermission getById(int id) {

        for (UserPermission tipo : values()) {

            if (tipo.id == id) {

                return tipo;

            }

        }

        return null;

    }


}
